{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set script_controller = 'course/recommend-list' %}

{% set menu = 'admin_course_recommend_list' %}

{% block main %}
  
  <form id="message-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
    {% include 'OrgBundle:Org:org-tree-select.html.twig' with {orgCode: app.request.get('orgCode'), modal: 'list'} %}
    <div class="form-group">
      <select style="width:150px;" class="form-control" name="categoryId">
        {{ select_options(category_choices('course'), app.request.query.get('categoryId'), '课程分类'|trans) }}
      </select>
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'标题'|trans}}" name="title" value="{{ app.request.get('title') }}">
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'创建者'|trans}}" name="creator" value="{{ app.request.get('creator') }}">
    </div>
    <button class="btn btn-primary">{{'搜索'|trans}}</button>

  </form>
  
  <table class="table table-striped table-hover mtl" id="course-recommend-table">
    <thead>
    <tr>
      <th>{{'顺序号'|trans}}</th>
      <th width="35%">{{'课程名称'|trans}}</th>
      {% include 'OrgBundle:Org/Parts:table-thead-tr.html.twig' %}
      <th>{{'创建者'|trans}}</th>
      <th>{{'推荐时间'|trans}}</th>
      <th>{{'操作'|trans}}</th>
    </tr>
    </thead>
    <tbody>
      {% for course in courses %}
        {% set user = users[course.userId]|default(null) %}
        {% set category = categories[course.categoryId]|default(null) %}
            {% include 'TopxiaAdminBundle:Course:course-recommend-tr.html.twig' %}
      {% else %}
        <tr><td colspan="20"><div class="empty">{{'暂无推荐课程'|trans}}</div></td></tr>
      {% endfor %}
    </tbody>
  </table>

  {{ admin_macro.paginator(paginator) }}

{% endblock %}